package com.huatai.bi.mapper;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huatai.bi.entity.MqClientNumberEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @program: ganghua
 * @description: 客户端连接数管理
 * @author: songxiude
 * @create: 2024-09-11 13:38
 **/
public interface MqClientNumberMapper extends BaseMapper<MqClientNumberEntity> {

	@Select("<script>" +
		"SELECT ip_port FROM mq_client_number WHERE is_active=1 AND ip_port IN" +
		"<foreach item='item' index='index' collection='ips' open='(' separator=',' close=')'>" +
		"#{item}" +
		"</foreach>" +
		"ORDER BY client_number LIMIT 1"+
		"</script>")
	String getMinClient(@Param("ips") List<String> ips);
}
